<!DOCTYPE HTML>
<html>

<head>
	<link rel="bookmark"  type="image/x-icon"  href="/img/logo_miccall.png"/>
	<link rel="shortcut icon" href="/img/logo_miccall.png">
	
			    <title>
    Ame雨
    </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="/amelin-ting/css/mic_main.css" />
    <link rel="stylesheet" href="/amelin-ting/css/dropdownMenu.css" />
    <meta name="keywords" content="Ame雨" />
    
    	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	 
    <noscript>
        <link rel="stylesheet" href="/amelin-ting/css/noscript.css" />
    </noscript>
    <style type="text/css">
        body:before {
          content: ' ';
          position: fixed;
          top: 0;
          background: url('/amelin-ting/img/bg.jpg') center 0 no-repeat;
          right: 0;
          bottom: 0;
          left: 0;
          background-size: cover; 
        }
    </style>

			    
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script async type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


    <script src="/amelin-ting/js/jquery.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrollex.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrolly.min.js"></script>
    <script src="/amelin-ting/js/skel.min.js"></script>
    <script src="/amelin-ting/js/util.js"></script>
    <script src="/amelin-ting/js/main.js"></script>
	
<meta name="generator" content="Hexo 5.4.0"></head>
    
		
<!-- Layouts -->



<!--  代码渲染  -->
<link rel="stylesheet" href="/css/prism_coy.css" />
<link rel="stylesheet" href="/css/typo.css" />
<!-- 文章页 -->
<body class="is-loading">
    <!-- Wrapper 外包 s-->
    <div id="wrapper" class="fade-in">
        <!-- Intro 头部显示 s -->
        <!-- Intro 头部显示 e -->
        <!-- Header 头部logo start -->
        <header id="header">
    <a href="/amelin-ting/" class="logo">Art Space</a>
</header>
        <!-- Nav 导航条 start -->
        <nav id="nav" class="special" >
            <ul class="menu links" >
			<!-- Homepage  主页  --> 
			<li >
	            <a href="/amelin-ting/" rel="nofollow">主页</a>
	        </li>
			<!-- categories_name  分类   --> 
	        
	        <li class="active">
	            <a href="#s1">分类</a>
	                    <ul class="submenu">
	                        <li>
	                        <a class="category-link" href="/amelin-ting/categories/Go/">Go</a></li><li><a class="category-link" href="/amelin-ting/categories/django/">django</a></li><li><a class="category-link" href="/amelin-ting/categories/drf/">drf</a></li><li><a class="category-link" href="/amelin-ting/categories/gin/">gin</a></li><li><a class="category-link" href="/amelin-ting/categories/go/">go</a></li><li><a class="category-link" href="/amelin-ting/categories/linux/">linux</a></li><li><a class="category-link" href="/amelin-ting/categories/mysql/">mysql</a></li><li><a class="category-link" href="/amelin-ting/categories/python/">python</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/">内网穿透</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%89%8D%E7%AB%AF/">前端</a>
	                    </ul>
	        </li>
	        
	        <!-- archives  归档   --> 
	        
	        
		        <!-- Pages 自定义   -->
		        
		        <li>
		            <a href="/about/" title="简历">
		                简历
		            </a>
		        </li>
		        
		        <li>
		            <a href="/group/" title="团队">
		                团队
		            </a>
		        </li>
		        
		        <li>
		            <a href="/gallery/" title="图库">
		                图库
		            </a>
		        </li>
		        
		        <li>
		            <a href="/tag/" title="标签">
		                标签
		            </a>
		        </li>
		        


            </ul>
            <!-- icons 图标   -->
			<ul class="icons">
                    
                    <li>
                        <a title="github" href="https://github.com/miccall" target="_blank" rel="noopener">
                            <i class="icon fa fa-github"></i>
                        </a>
                    </li>
                    
                    <li>
                        <a title="500px" href="http://500px.com" target="_blank" rel="noopener">
                            <i class="icon fa fa-500px"></i>
                        </a>
                    </li>
                    
			</ul>
</nav>

        <div id="main" >
            <div class ="post_page_title_img" style="height: 25rem;background-image: url(https://img2.baidu.com/it/u=1873433626,2532016327&amp;fm=26&amp;fmt=auto);background-position: center; background-repeat:no-repeat; background-size:cover;-moz-background-size:cover;overflow:hidden;" >
                <a href="#" style="padding: 4rem 4rem 2rem 4rem ;"><h2 >Go布尔整数浮点复数</h2></a>
            </div>
            <!-- Post -->
            <div class="typo" style="padding: 3rem;">
                <h2 id="一、布尔型"><a href="#一、布尔型" class="headerlink" title="一、布尔型"></a>一、布尔型</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 布尔类型</span><br><span class="line">	<span class="keyword">var</span> b <span class="keyword">bool</span> &amp; <span class="keyword">var</span> b <span class="keyword">bool</span>=<span class="literal">true</span> &amp; <span class="keyword">var</span> b =<span class="literal">true</span></span><br><span class="line">	<span class="comment">// 这样写都可以</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 操作符</span><br><span class="line">	== <span class="comment">// 等于</span></span><br><span class="line">	!= <span class="comment">// not 非</span></span><br><span class="line">	&amp;&amp; <span class="comment">// and 和</span></span><br><span class="line">	|| <span class="comment">// or 或</span></span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> 取反 </span><br><span class="line">	!b</span><br><span class="line"></span><br><span class="line"><span class="number">4.</span> 格式化输出占位符</span><br><span class="line">	%t	</span><br><span class="line"></span><br><span class="line"><span class="number">5.</span> 注意</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">    布尔类型变量的默认值为false。</span></span><br><span class="line"><span class="comment">    Go 语言中不允许将整型强制转换为布尔型.</span></span><br><span class="line"><span class="comment">    布尔型无法参与数值运算，也无法与其他类型进行转换。</span></span><br><span class="line"><span class="comment">    */</span></span><br></pre></td></tr></table></figure>

<h2 id="二、整型和浮点型"><a href="#二、整型和浮点型" class="headerlink" title="二、整型和浮点型"></a>二、整型和浮点型</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>整型&amp;浮点型</span><br><span class="line">	<span class="keyword">int8</span>  <span class="keyword">int16</span>  <span class="keyword">int32</span>  <span class="keyword">int64</span> <span class="comment">// 带符号</span></span><br><span class="line">	<span class="keyword">uint8</span>  <span class="keyword">uint16</span>  <span class="keyword">uint32</span> <span class="keyword">uint64</span> <span class="comment">// 不带符号</span></span><br><span class="line">	<span class="keyword">int</span>&amp;<span class="keyword">uint</span>,和操作系统平台有关系 <span class="comment">// 特殊整形</span></span><br><span class="line">	<span class="keyword">float32</span>&amp;<span class="keyword">float64</span> 是浮点类型</span><br><span class="line">	<span class="comment">// 所有整数初始化为0， 所有浮点数初始化为0.0 布尔类型初始化为false</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 注意的点</span><br><span class="line">	Go是强类型语言，不同类型相加以及赋值是不允许的</span><br><span class="line">	输出占位符 </span><br><span class="line">		%d <span class="comment">// 整数</span></span><br><span class="line">		%x <span class="comment">// 十六进制</span></span><br><span class="line">		%f <span class="comment">// 浮点数</span></span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> 怎么才能让不同类型的相加</span><br><span class="line">	<span class="keyword">package</span> main</span><br><span class="line"></span><br><span class="line">    <span class="keyword">import</span> (</span><br><span class="line">        <span class="string">&quot;fmt&quot;</span></span><br><span class="line">    )</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">        <span class="keyword">var</span> a <span class="keyword">int</span> = <span class="number">10</span></span><br><span class="line">        <span class="keyword">var</span> b <span class="keyword">int8</span> = <span class="number">10</span></span><br><span class="line">        <span class="keyword">var</span> c <span class="keyword">int</span></span><br><span class="line">        c = a + <span class="keyword">int</span>(b)</span><br><span class="line">        fmt.Print(c)</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<h2 id="三、八进制-amp-十六进制数"><a href="#三、八进制-amp-十六进制数" class="headerlink" title="三、八进制&amp;十六进制数"></a>三、八进制&amp;十六进制数</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// Go语言中无法直接定义二进制数，关于八进制和十六进制数的示例如下</span></span><br><span class="line">    <span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">        <span class="keyword">var</span> i = <span class="number">100</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%d\n&quot;</span>, i)</span><br><span class="line">        fmt.Printf(<span class="string">&quot;%b\n&quot;</span>, i) <span class="comment">// 把十进制转换成二进制</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%o\n&quot;</span>, i) <span class="comment">//  把十进制转换成八进制</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%x\n&quot;</span>, i) <span class="comment">// 把十进制转换成十六进制</span></span><br><span class="line">        <span class="comment">// 八进制</span></span><br><span class="line">        i2 := <span class="number">077</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%d\n&quot;</span>, i2)</span><br><span class="line">        <span class="comment">// 十六进制</span></span><br><span class="line">        i3 := <span class="number">0x1234567</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%d\n&quot;</span>, i3)</span><br><span class="line">        <span class="comment">// 查看变量的类型</span></span><br><span class="line">        fmt.Printf(<span class="string">&quot;%T\n&quot;</span>, i3)</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<h2 id="四、复数"><a href="#四、复数" class="headerlink" title="四、复数"></a>四、复数</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">complex64</span> &amp; <span class="keyword">complex128</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">var</span> c1 <span class="keyword">complex64</span></span><br><span class="line">    c1 = <span class="number">1</span> + <span class="number">2i</span></span><br><span class="line">    <span class="keyword">var</span> c2 <span class="keyword">complex128</span></span><br><span class="line">    c2 = <span class="number">2</span> + <span class="number">3i</span></span><br><span class="line">    fmt.Println(c1)</span><br><span class="line">    fmt.Println(c2)</span><br><span class="line"><span class="comment">// 复数有实部和虚部，complex64的实部和虚部为32位，complex128的实部和虚部为64位</span></span><br></pre></td></tr></table></figure>

<h2 id="六、goland语言特性"><a href="#六、goland语言特性" class="headerlink" title="六、goland语言特性"></a>六、goland语言特性</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 垃圾回收</span><br><span class="line">	内存自动回收，再也不需要手动回收</span><br><span class="line">	开发人员只用专注业务实现</span><br><span class="line">	只需要<span class="built_in">new</span>分配内存 不需要释放</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 天然并发</span><br><span class="line">	从语言层面上来讲，支持并发，而且非常简单</span><br><span class="line">	goroutine,轻量级线程,创建成千上万个goroute成为可能</span><br><span class="line">	基于CSP模型实现</span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> channel</span><br><span class="line">	管道，类似unix/linux的pipe</span><br><span class="line">	多个goroute之间通过channel进行通信</span><br><span class="line">	支持任何类型</span><br><span class="line">	<span class="comment">// 代码演示</span></span><br><span class="line">        <span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">            pipe := <span class="built_in">make</span>(<span class="keyword">chan</span> <span class="keyword">int</span>, <span class="number">3</span>)</span><br><span class="line">            pipe &lt;- <span class="number">1</span></span><br><span class="line">            pipe &lt;- <span class="number">2</span></span><br><span class="line">            car a <span class="keyword">int</span></span><br><span class="line">            a = &lt;- p</span><br><span class="line">            fmt.Printf(%v, a)</span><br><span class="line">        &#125;</span><br></pre></td></tr></table></figure>

<h2 id="作业练习"><a href="#作业练习" class="headerlink" title="作业练习"></a>作业练习</h2><figure class="highlight go"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 编写代码分别定义一个整型、浮点型、布尔型、字符串型变量，使用fmt.Printf()搭配%T分别打印出上述变量的值和类型</span><br><span class="line">        <span class="keyword">package</span> main</span><br><span class="line"></span><br><span class="line">        <span class="keyword">import</span> (</span><br><span class="line">            <span class="string">&quot;fmt&quot;</span></span><br><span class="line">        )</span><br><span class="line"></span><br><span class="line">        <span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">            <span class="keyword">var</span> i <span class="keyword">int</span></span><br><span class="line">            <span class="keyword">var</span> f <span class="keyword">float32</span></span><br><span class="line">            <span class="keyword">var</span> b <span class="keyword">bool</span></span><br><span class="line">            <span class="keyword">var</span> s <span class="keyword">string</span></span><br><span class="line">            fmt.Printf(<span class="string">&quot;value of i: %d type of i: %T\n&quot;</span>, i, i)</span><br><span class="line">            fmt.Printf(<span class="string">&quot;value of f: %f type of f: %T\n&quot;</span>, f, f)</span><br><span class="line">            fmt.Printf(<span class="string">&quot;value of b: %v type of b: %T\n&quot;</span>, b, b)</span><br><span class="line">            fmt.Printf(<span class="string">&quot;value of s: %s type of s: %T\n&quot;</span>, s, s)</span><br><span class="line">        &#125;		</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">    value of i: 0 type of i: int</span></span><br><span class="line"><span class="comment">    value of f: 0.000000 type of f: float32</span></span><br><span class="line"><span class="comment">    value of b: false type of b: bool</span></span><br><span class="line"><span class="comment">    value of s:  type of s: string</span></span><br><span class="line"><span class="comment">    */</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 实现一个密码生成工具，支持以下功能：</span><br><span class="line">        提示：可以用标准包 “flag”解析命令行参数</span><br><span class="line">        a) 用户可以通过-l指定生成密码的长度</span><br><span class="line">        b) 用户可以通过-t指定生成密码的字符集，</span><br><span class="line">            比如-t num生成全数字的密码</span><br><span class="line">             t char 生成包含全英文字符的密码，-t mix包含生成数字和英文的密码，</span><br><span class="line">             t advance 生成包含数字、英文以及特殊字符的密码</span><br><span class="line"></span><br><span class="line"><span class="comment">// 代码演示</span></span><br><span class="line"><span class="keyword">package</span> main</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> (</span><br><span class="line">    <span class="string">&quot;flag&quot;</span></span><br><span class="line">    <span class="string">&quot;fmt&quot;</span></span><br><span class="line">    <span class="string">&quot;math/rand&quot;</span></span><br><span class="line">    <span class="string">&quot;time&quot;</span></span><br><span class="line">)</span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> (</span><br><span class="line">    numCharset     = <span class="string">&quot;0123456789&quot;</span></span><br><span class="line">    strCharset     = <span class="string">&quot;abcdefghigklmnopqlstuvwxyzABCDEFGHIJKLMNOPQLSTUVWXYZ&quot;</span></span><br><span class="line">    mixCharset     = <span class="string">&quot;0123456789abcdefghigklmnopqlstuvwxyzABCDEFGHIJKLMNOPQLSTUVWXYZ&quot;</span></span><br><span class="line">    advanceCharset = <span class="string">&quot;0123456789abcdefghigklmnopqlstuvwxyzABCDEFGHIJKLMNOPQLSTUVWXYZ!@$^&quot;</span></span><br><span class="line">)</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</span><br><span class="line">    <span class="keyword">var</span> length <span class="keyword">int</span></span><br><span class="line">    <span class="keyword">var</span> charset <span class="keyword">string</span></span><br><span class="line">    flag.IntVar(&amp;length, <span class="string">&quot;l&quot;</span>, <span class="number">16</span>, <span class="string">&quot;-l the length of password&quot;</span>)</span><br><span class="line">    flag.StringVar(&amp;charset, <span class="string">&quot;t&quot;</span>, <span class="string">&quot;mix&quot;</span>, <span class="string">&quot;-t the charste of password&quot;</span>)</span><br><span class="line">    flag.Parse()</span><br><span class="line"></span><br><span class="line">    rand.Seed(time.Now().UnixNano())</span><br><span class="line"></span><br><span class="line">    <span class="keyword">var</span> userCharset <span class="keyword">string</span></span><br><span class="line">    <span class="keyword">switch</span> charset &#123;</span><br><span class="line">        <span class="keyword">case</span> <span class="string">&quot;num&quot;</span>:</span><br><span class="line">        userCharset = numCharset</span><br><span class="line">        <span class="keyword">case</span> <span class="string">&quot;char&quot;</span>:</span><br><span class="line">        userCharset = strCharset</span><br><span class="line">        <span class="keyword">case</span> <span class="string">&quot;mix&quot;</span>:</span><br><span class="line">        userCharset = mixCharset</span><br><span class="line">        <span class="keyword">case</span> <span class="string">&quot;advance&quot;</span>:</span><br><span class="line">        userCharset = advanceCharset</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">var</span> password []<span class="keyword">byte</span></span><br><span class="line">    <span class="keyword">for</span> i := <span class="number">0</span>; i &lt; length; i++ &#123;</span><br><span class="line">        index := rand.Intn(<span class="built_in">len</span>(userCharset))</span><br><span class="line">        char := userCharset[index]</span><br><span class="line">        password = <span class="built_in">append</span>(password, char)</span><br><span class="line">    &#125;</span><br><span class="line">    strpassword := <span class="keyword">string</span>(password)</span><br><span class="line">    fmt.Println(strpassword)</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>




            </div>

            <!-- Post Comments -->
            
    <!-- 使用 DISQUS_CLICK -->
<div id="disqus-comment">
    <div id="disqus_thread"></div>

<!-- add animation -->
<style>
	.disqus_click_btn {
            line-height: 30px;
            margin: 0;
            min-width: 50px;
            padding: 0 14px;
            display: inline-block;
            font-family: "Roboto", "Helvetica", "Arial", sans-serif;
            font-size: 14px;
            font-weight: 400;
            text-transform: uppercase;
            letter-spacing: 0;
            overflow: hidden;
            will-change: box-shadow;
            transition: box-shadow .2s cubic-bezier(.4, 0, 1, 1), background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
            outline: 0;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            vertical-align: middle;
            border: 0;
            background: rgba(158, 158, 158, .2);
            box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
            color: #fff;
            background-color: #7EC0EE;
            text-shadow: 0
        }
</style>
	
<div class="btn_click_load" id="disqus_bt"> 
    <button class="disqus_click_btn">点击查看评论</button>
</div>

<!--
<script type="text/javascript">
$('.btn_click_load').click(function() {
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'http-miccall-tech'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();

    document.getElementById('disqus_bt').style.display = "none";
});
</script>
-->
<script type="text/javascript">
    var disqus_config = function () {
        this.page.url = 'https://gitee.com/AmeX/amelin-ting.git/2020/03/04/Go%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B------%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B/';  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = 'https://gitee.com/AmeX/amelin-ting.git/2020/03/04/Go%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B------%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B/'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
</script>

<script type="text/javascript">
    $('.btn_click_load').click(function() {  //click to load comments
        (function() { // DON'T EDIT BELOW THIS LINE
            var d = document;
            var s = d.createElement('script');
            s.src = '//http-miccall-tech.disqus.com/embed.js';
            s.setAttribute('data-timestamp', + new Date());
            (d.head || d.body).appendChild(s);
        })();
        $('.btn_click_load').css('display','none');
    });
</script>
</div>
<style>
    #disqus-comment{
        background-color: #eee;
        padding: 2pc;
    }
</style>


        </div>
        <!-- Copyright 版权 start -->
                <div id="copyright">
            <ul>
                <li>&copy;Powered By <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/" style="border-bottom: none;">hexo</a></li>
                <li>Design: <a target="_blank" rel="noopener" href="http://miccall.tech " style="border-bottom: none;">miccall</a></li>
            </ul>
            
                <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
			
        </div>
    </div>
</body>



 	
</html>
